<html>
<head>
	<meta http-equiv="content-type" content="text/html; charset=utf-8" />
<title>Business Permit Application</title>
	<meta name="keywords" content="" />
	<meta name="description" content="" />
	<link href="styles.css" rel="stylesheet" type="text/css" />
	<link rel="stylesheet" href="nivo-slider.css" type="text/css" media="screen" />
	<script src="SpryAssets/SpryValidationTextField.js" type="text/javascript"></script>
	<script src="SpryAssets/SpryValidationSelect.js" type="text/javascript"></script>
	<link href="SpryAssets/SpryValidationTextField.css" rel="stylesheet" type="text/css" />
      
<link href="SpryAssets/SpryValidationSelect.css" rel="stylesheet" type="text/css">
</head>
<body>
	<div id="bg">
	<div id="logo">
	<img src="images/logo_and_name.png" alt="" width="305" height="78" />

  	<h2>&nbsp;</h2></div>
	<div id="main">
    <div id="out"><h3><p align="right"><a href="bpApp.php">Home</a>&nbsp;&nbsp;|<a href="logout.php">logout</a></p></h3></div>
	<!-- header begins -->
	
	
    <script language="JavaScript">
function validate(){
if ((document.ApplicationForm.TypeOrg.value=="") || (document.ApplicationForm.TPFN.value=="") ||(document.ApplicationForm.TPLN.value=="") ||(document.ApplicationForm.BName.value==""))
{
window.alert("Please Enter Important Informations!");
return false;
}
 else
 {
 return true;
 }
}


</script>


        <div id="buttons">
		<ul>
			<li class="first"><a href="index.php"  title="">Home</a></li>
        <li><a href="UserList.php" title="">User List</a></li>
			<li><a href="bpApp.php" title="">Business Permit</a></li>
			<li><a href="#" title="">Real Property</a></li>
		</ul></div>
<!-- header ends -->
<!-- content begins -->
<div id="content_bg">
    <div id="column_box">
      <div id="bg_left"></div>
      <div id="bg_right"></div>
      <div class="clear"></div>
    </div>
   <div class="container">
    	 <center>
       <center>
         <form name="ApplicationForm" method="post" action="bpApp.php">
          <input type="hidden" name="act" id="act" value="<?php echo $x; ?>">
         
         <h1>Application For Business Permit</h1></br>
      <table width="947" border="1">
  <tr>
      <td width="335" background="images/img5 - Copy - Copy.jpg" class="table0"><font color="#FFFFFF">&nbsp;</font>
      
    </td>
    </tr>
</table>


            <table width="947" height="115" border="1">
            
  <tr>
 	<td width="449" bgcolor="#CCCCCC" class="table0" ><font color="#000000">Date of Application:</font>&nbsp;&nbsp;
     <?php
	 $date2 = date("F d, Y",mktime());
	 echo $date2;
    ?></td>
        
        <td width="482" bgcolor="#CCCCCC"><font color="#000000">DTI/SEC/CDA Registration No.:</font> &nbsp;   &nbsp;
          <input name="DTI_SEC_CDARegistrationNo" type="text" id="textfield1" value="" size="33" />
          </td>
        
        <tr>
         <td bgcolor="#CCCCCC"><font color="#000000">Reference No. :</font>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;
           <input name="RefNo" type="text" value="" size="33" />
          </td>
    
    	<td bgcolor="#CCCCCC" class="table0" ><font color="#000000">DTI/SEC/CDA Date of Registration:&nbsp;</font> <select name="RegYear">
            <?php
			$m= array('January', 'February','March', 'April','May', 'June','July','August','September','October','November','December');
			$mon =date('m')-1;
			for($i=0;$i<12; $i++){
				if ($i==$mon)
				{
					$s="selected='selected'";
				}
				else
				{
					$s="";
					}
			$mo =100+$i+1;
			echo '<option value="'.substr($mo,1,2).'" '.$s.'>'.$m[$i].'</option>';
			}
			
			?>

            </select>
              <select name="RegMonth">
                <?php
			  $d =date('d');
			  for($i=1; $i<date('t')+1; $i++){
				  if($i==$d)
				  {
					  $s="selected='selected'";
				  }
				  else
				  {
					  $s="";}
					  echo'<option value"'.sprintf("%02",$i).'" '.$s.'>'.$i.'</option>';
			  }
			  ?>
              </select>
              <select name="RegDay">
                <?php
   $y = date('Y');
   for($i=$y; $i>$y-100; $i-- ){
	   if($i==$y)
					{
						$s="selected='selected'";
					}
					else
					{
						$s="";
					}
   echo  '<option value="'.$i.'" '.$s.'>'.$i.'</option>';
   }
    ?>
              </select>
              </td>
         </tr>
         
         	<tr>
    			<td bgcolor="#CCCCCC"><font color="#000000">Type of Organization: 
                    
                    <span id="spryselect2">
                    <select name="TypeOrg" id="selection">
                      <option value="Single">Single</option>
                      <option value="Partnership">Partnership</option>
                      <option value=" Corporation"> Corporation</option>
                      <option value="Cooperative">Cooperative</option>
                    </select>
                    <span class="selectRequiredMsg">Please select Organization</span></span> </font>
      </td>
    <td bgcolor="#CCCCCC"><font color="#000000"> BIR TIN:&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;
 <input type="text" name="TIN1" size="3" maxlength="3" />-<input type="text" name="TIN2" size="3" maxlength="3" />-<input type="text" name="TIN3" size="3" maxlength="3" />
     </font> </td>
   </tr>
</table>

		
        
        <table width="947" border="1">
 
  <tr>
    <td background="images/img5 - Copy - Copy.jpg"><font color="#FFFFFF">Name of Tax payer:</font></td>
  </tr>
  </table>
    	<table width="947" border="1">
  		<tr>
    		<td width="193" bgcolor="#CCCCCC"><font color="#000000">Last Name:</font><span id="sprytextfield7"><input name="TPLN" type="text" id="textfield4" value="" size="33" /><span class="textfieldRequiredMsg">A value is required.</span></span></td>
    		<td width="192" bgcolor="#CCCCCC"><font color="#000000">First Name:</font><span id="sprytextfield8"><span class="textfieldRequiredMsg">A value is required.</span></span></td>
    		<td width="229" bgcolor="#CCCCCC"><font color="#000000">Middle Name:</font><span id="sprytextfield9">
    		  <input name="TPMN" type="text" value="" size="33" />
    		  <span class="textfieldRequiredMsg">A value is required.</span></span></td>
  			</tr>
		</table>

		
		<table width="947" border="1">
  		<tr>
    	<td width="723" bgcolor="#CCCCCC"><font color="#000000">Business Name: </font><span id="sprytextfield10">
    	  <input name="BName" type="text" id="textfield6" value="" size="60" />
    	  <span class="textfieldRequiredMsg">A value is required.</span></span></td>
  	   </tr>
 	 	<tr>
    
    	<td bgcolor="#CCCCCC"><font color="#000000">Trade Name/Franchise:</font>
    	  <input name="TradeName" type="text" id="textfield7" value="" size="51" />
    	  </td>
  		</tr>
 		 <tr>
    	<td background="images/img5 - Copy - Copy.jpg"><font color="#FFFFFF">Name of President/Treasurer of Corporation:</font> </td>
  		</tr>
		</table>
		<input name="TPFN" type="text" id="textfield5" value="" size="33" />

	<table width="947" border="1">
	  <tr>
    	<td width="196" bgcolor="#CCCCCC"><font color="#000000">Last Name:</font>
    	  <input name="PLName" type="text" id="textfield8" value="" size="25" />
    	  &nbsp;</td>
    	<td width="199" bgcolor="#CCCCCC"><font color="#000000">First Name:</font>
    	  <input name="PFName" type="text" value="" id="textfield9" size="25" />
    	  &nbsp;</td>
    	<td width="219" bgcolor="#CCCCCC"><font color="#000000">Middle Name:</font>
    	  <input name="PMName" type="text" id="textfield10" value="" size="25" />
    	  <span class="textfieldRequiredMsg">A value is required.</span></span>&nbsp;</td>
  		</tr>
		</table>

        
        
        <table width="947" border="1">
  <tr>
    <td width="559" background="images/img5 - Copy - Copy.jpg"><div align="center"><font color="#FFFFFF">Business Address</font></div></td>
    <td width="559" background="images/img5 - Copy - Copy.jpg"><div align="center"><font color="#FFFFFF">Owner's Address</font></div></td>
  </tr>
  <tr>
    <td bgcolor="#CCCCCC"><font color="#000000">House No./Bldg.No. Building Name:</font> <span id="sprytextfield11">
      <input name="BHouseNo" type="text" id="textfield11" value="" size="33" />
      <span class="textfieldRequiredMsg">A value is required.</span></span></td>
    <td bgcolor="#CCCCCC"><font color="#000000">House No./Bldg. No. Building Name:</font><span id="sprytextfield12">
      <input name="OHouseNo" type="text" id="textfield12" value="" size="33" />
      <span class="textfieldRequiredMsg">A value is required.</span></span></td>
  </tr>
  <tr>
    <td bgcolor="#CCCCCC"><font color="#000000">Unit No. :</font>
      <input name="BUnitNo" type="text" id="textfield13" value="" size="64" />
      <span class="textfieldRequiredMsg">A value is required.</span></span></td>
    <td bgcolor="#CCCCCC"><font color="#000000">Unit No.: </font>
      <input name="OUnitNo" type="text" id="textfield14" value="" size="65" />
      </td>
  </tr>
  <tr>
    <td bgcolor="#CCCCCC"><font color="#000000">Street :</font><input name="BStreet" type="text" id="textfield15" value="" size="67" /></td>
    <td bgcolor="#CCCCCC"><font color="#000000">Street: </font><input name="OStreet" type="text" id="textfield16" value="" size="67" />
    </td>
  </tr>
  <tr>
    <td bgcolor="#CCCCCC"><font color="#000000">Barangay:</font><span id="sprytextfield13">
     <select name="BBrgy">
            <?php 
				$connect = mysql_connect("localhost","root","") or die("Couldn't connect");
				mysql_select_db("business-is") or die("Cannnot find database!");
				$result=mysql_query("SELECT * FROM barangay") or die (mysql_error());
					while ($row = mysql_fetch_array($result))
{
	$BrgyName=$row['BrgyName'];
	echo "<option value='$BrgyName'>$BrgyName</option>";
}			?></select>
      <span class="textfieldRequiredMsg">A value is required.</span></span></td>
    <td bgcolor="#CCCCCC"><font color="#000000">Barangay:</font><span id="sprytextfield16">
      <input name="OBrgy" type="text" value="" id="textfield18" size="63" />
      <span class="textfieldRequiredMsg">A value is required.</span></span></td>
  </tr>
  <tr>
    <td bgcolor="#CCCCCC"><font color="#000000">Subdivision:</font><input name="BSubd" type="text" id="textfield19" value="" size="62" /></td>
    <td bgcolor="#CCCCCC"><font color="#000000">Subdivision:</font><input name="OSubd" type="text" id="textfield20" value="" size="62" /></td>
  </tr>
  <tr>
    <td bgcolor="#CCCCCC"><font color="#000000">Municipality:</font> <input name="BMunicipality" type="text" id="textfield21" value="Guinobatan" size="61" /></td>
    <td bgcolor="#CCCCCC"><font color="#000000">Municipality:</font><input name="OMunicipality" type="text" id="textfield22" value="" size="62" /></td>
  </tr>
  <tr>
    <td bgcolor="#CCCCCC"><font color="#000000">Province:</font><span id="sprytextfield14">
      <input name="BProvince" type="text" id="textfield23" value="Albay" size="64" />
      <span class="textfieldRequiredMsg">A value is required.</span></span></td>
    <td bgcolor="#CCCCCC"><font color="#000000">Province:</font><span id="sprytextfield15">
      <input name="OProvince" id="textfield24" type="text" value="" size="64" />
      <span class="textfieldRequiredMsg">A value is required.</span></span></td>
  </tr>
  <tr>
    <td bgcolor="#CCCCCC"><font color="#000000">Tel No.:</font> <input name="BTelNo" type="text" id="textfield25" value="" size="66" /></td>
    <td bgcolor="#CCCCCC"><font color="#000000">Tel No.: </font><input name="OTelNo" type="text" id="textfield26" value="" size="66" /></td>
  </tr>
  <tr>
    <td bgcolor="#CCCCCC"><font color="#000000">Email Address:</font> <input name="BEmailAdd" type="text" id="textfield27" value="" size="58" />
      </td>
    <td bgcolor="#CCCCCC"><font color="#000000"><font color="#000000">Email Address: </font></font><input name="OEmailAdd" type="text" id="textfield28" value="" size="58" /></td>
  	</tr>
	</table>
			<table width="947" border="1">
  			<tr>
   			 <td width="800" bgcolor="#CCCCCC"><font color="#000000">Property Index Number (PIN):  </font><select name="PIN">
            <?php 
				$connect = mysql_connect("localhost","root","") or die("Couldn't connect");
				mysql_select_db("business-is") or die("Cannnot find database!");
				$result=mysql_query("SELECT * FROM property") or die (mysql_error());
					while ($row = mysql_fetch_array($result))
{
	$PIN=$row['PIN'];
	echo "<option value='$PIN'>$PIN</option>";
}			?></select></td>
    		</tr>
		</table>

		<table width="947" border="1">
 		 <tr>
   		 <td width="271" bgcolor="#CCCCCC"><font color="#000000">Business Area:&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;
      		<input name="BusinessArea" type="text" id="textfield30" value="" size="10" />sq. m</font></td>
   <td width="355" bgcolor="#CCCCCC"><font color="#000000">Total No. of Employees In Establishment:</font>
      		<input name="TotalNoEmp" type="number" id="textfield31" value="" size="5" /> </td>
    <td width="299" bgcolor="#CCCCCC"><font color="#000000">No. of Employees Residing in LGU:</font> <input name="NoEmpLGU" type="number" id="textfield32" value="" size="5" /></td>
  		</tr>
		</table>

<table width="947" border="1">
  <tr>
    <td width="620" background="images/img5 - Copy - Copy.jpg"><font color="#FFFFFF">If place of Business is Rented, please identify the following: Lessor's Name</font></td>
  </tr>
</table>
<table width="947" border="1">
  <tr>
    <td width="372" bgcolor="#CCCCCC"><font color="#000000">Last Name:</font> <input name="LessorLN" type="text" value="" id="textfield33" size="25" /></td>
    <td width="395" bgcolor="#CCCCCC"><font color="#000000">First Name: </font>
      <input name="LessorFN" type="text" id="textfield34" value="" size="25" /></td>
    <td width="345" bgcolor="#CCCCCC"><font color="#000000">Middle Name: </font>
      <input name="LessorMN" type="text" id="textfield35" value="" size="25" /></td>
  </tr>
</table>

<table width="947" border="1">
  <tr>
    <td background="images/img5 - Copy - Copy.jpg"><font color="#FFFFFF">Lessor's Address:</font> </td>
  </tr>
</table>
<table width="947" border="1">
  <tr>
    <td width="308" bgcolor="#CCCCCC"><font color="#000000">House No./Bldg. No.Building Name:</font><input name="LHouseNo" type="text" id="textfield36" value="" size="30" /></td>
    <td width="310" bgcolor="#CCCCCC"><font color="#000000">Municipality:</font><input name="LMunicipality" type="text" id="textfield37" value="Guinobatan" size="45" /></td>
  </tr>
  <tr>
    <td bgcolor="#CCCCCC"><font color="#000000">Street:</font><input name="LStreet" type="text" id="textfield38" value="" size="64" /></td>
    <td bgcolor="#CCCCCC"><font color="#000000">Province:</font><input name="LProvince" type="text" id="textfield39" value="" size="49" /></td>
  </tr>
  <tr>
    <td bgcolor="#CCCCCC"><font color="#000000">Barangay:</font><input name="LBrgy" type="text" value="" id="textfield40" size="60" /></td>
    <td bgcolor="#CCCCCC"><font color="#000000">Tel. No.</font><input name="LTelNo" type="text" value="" id="textfield41" size="50" /></td>
  </tr>
  <tr>
    <td bgcolor="#CCCCCC"><font color="#000000">Subdivision:</font><input name="LSubd" type="text" id="textfield42" value="" size="57" /></td>
    <td bgcolor="#CCCCCC">&nbsp;</td>
  </tr>
</table>
<table width="947" border="1">
  <tr>
    <td width="285" height="26" bgcolor="#CCCCCC"><font color="#000000">Incase of Emergency</font></td>
    <td width="620" bgcolor="#CCCCCC"><font color="#000000">Contact Person/Tel No./Mobile Phone/Email Address:</font> <input name="LContactNo" type="text" id="textfield43" value="" size="40" /></td>
  </tr>
</table>
<table width="947" height="20" border="1">
  <tr>
    <td valign="top" background="images/img5 - Copy - Copy.jpg"><div align="center"><strong><font color="#FFFFFF"><p>
  
     <input name="BID1" type="hidden" value="<?php echo date("Y"); ?>">
          <input name="BID2" type="hidden" value="4503"><input name="BID3" type="hidden" value="<?php $time = time(); echo $time;?>">  
               
    <input type="submit" name="btn_submit" value="Submit" >
    <input type="reset" name="reset" value="Reset" />
    </form></p></font></strong>
  
    </div><div></div></td>
  </tr>
    </table>
    
    </center>

    <?php
		include "db_config.php";
		if(isset($_POST['btn_submit']))
		   {
	$table_name = "personal_info";
	$BID=$_POST['BID1'].'-'.$_POST['BID2'].'-'.$_POST['BID3'];
	$PresName=$_POST['PLName'].','.$_POST['PFName'].' '.$_POST['PMName'];
	$BAddress=$_POST['BHouseNo'].' '.$_POST['BStreet'].' '.$_POST['BBrgy'].' '.$_POST['BSubd'].' '.$_POST['BMunicipality'].' '.$_POST['BProvince'];
	$TaxpayerName=$_POST['TPLN'].','.$_POST['TPFN'].' '.$_POST['TPMN'];
	$TIN=$_POST['TIN1'].'-'.$_POST['TIN2'].'-'.$_POST['TIN3'];
	$DTI_SEC_CDARegistrationDate=$_POST['RegYear'].'/'.$_POST['RegMonth'].'/'.$_POST['RegDay'];
	
	$sql = "INSERT INTO $table_name(BID, BName, TradeName, PresName, BAddress, BTelNo, BEmailAdd, BusinessArea, TotalNoEmp, NoEmpLGU, TypeOrg, LineBusiness, AppDate, TaxpayerName, OAddress, OTelNo, OEmailAdd, Nature_Code, Capitalization, ModePayment, TIN, DTI_SEC_CDARegistrationNo,  DTI_SEC_CDARegistrationDate,act) 

VALUES('$BID','$_POST[BName]','$_POST[TradeName]','$PresName','$BAddress','$_POST[BTelNo]','$_POST[BEmailAdd]','$_POST[BusinessArea]','$_POST[TotalNoEmp]','$_POST[NoEmpLGU]','$_POST[TypeOrg]','$_POST[LineBusiness]',NOW(),'$TaxpayerName','$OHouseNo $OUnitNo $OStreet $OBrgy $OSubd $OMunicipality $OProvince','$_POST[OTelNo]','$_POST[OEmailAdd]','$_POST[Nature_Code]','$_POST[Capitalization]','$_POST[ModePayment]','$TIN','$_POST[DTI_SEC_CDARegistrationNo]','$DTI_SEC_CDARegistrationDate','$_POST[act]')"; 

$result = mysql_query($sql,$connection) or die (mysql_error());
echo "<font color=\"#000066\"><h3>FILLED OUT COMPLETE</h3></font>";

	}
	if($sql){
		   ?>
           <script type="text/javascript">
	window.location='index3.php';
</script>
<?php
		}
?>
           
              	</div>
              

</div>
<!-- content ends -->
<!-- footer begins -->
<div id="footer">
 <a href="http://validator.w3.org/check?uri=referer">Copyrights © 2012</a> | <a href="http://guinobatan.gov.ph/index.php/guinobatan/index">Municipality of Guinobatan</a>. | All rights reserved. 
      </p></div>
<!-- footer ends -->
</div>
</div>
<script type="text/javascript">
var sprytextfield2 = new Spry.Widget.ValidationTextField("sprytextfield2");
var sprytextfield1 = new Spry.Widget.ValidationTextField("sprytextfield1");
var sprytextfield7 = new Spry.Widget.ValidationTextField("sprytextfield7");
var sprytextfield8 = new Spry.Widget.ValidationTextField("sprytextfield8");
var sprytextfield9 = new Spry.Widget.ValidationTextField("sprytextfield9");
var sprytextfield10 = new Spry.Widget.ValidationTextField("sprytextfield10");
var sprytextfield11 = new Spry.Widget.ValidationTextField("sprytextfield11");
var sprytextfield12 = new Spry.Widget.ValidationTextField("sprytextfield12");
var sprytextfield13 = new Spry.Widget.ValidationTextField("sprytextfield13");
var sprytextfield14 = new Spry.Widget.ValidationTextField("sprytextfield14");
var sprytextfield15 = new Spry.Widget.ValidationTextField("sprytextfield15");
var sprytextfield16 = new Spry.Widget.ValidationTextField("sprytextfield16");
var spryselect1 = new Spry.Widget.ValidationSelect("spryselect1");
var spryselect2 = new Spry.Widget.ValidationSelect("spryselect2");
</script>
</body>
</html>